From: jchesterfield@dhcp92.uk.xensource.com Date: Wed, 6 Sep 2006 10:42:29 +0000 (+0100) Subject: [BLKTAP] Fix in xend to properly destroy blktap devices when deviceClass=='tap' X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15668^2~5 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=c2a28ee6acc69aef35e02a348dbcb3e1bd28a9bc;p=xen.git [BLKTAP] Fix in xend to properly destroy blktap devices when deviceClass=='tap' Submitted by Andres Lagar Cavilla --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 7505e44f97..033d92ffc4 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1087,6 +1087,15 @@ class XendDomainInfo: ## public: def destroyDevice(self, deviceClass, devid): + if type(devid) is str: + devicePath = '%s/device/%s' % (self.dompath, deviceClass) + for entry in xstransact.List(devicePath): + backend = xstransact.Read('%s/%s' % (devicePath, entry), "backend") + devName = xstransact.Read(backend, "dev") + if devName == devid: + # We found the integer matching our devid, use it instead + devid = entry + break return self.getDeviceController(deviceClass).destroyDevice(devid)